<template>
    <div class="entrance">
        <!-- <a-button @click="login">申报</a-button>
        <a-button @click="login1">后台</a-button> -->
        <header-cont :page="loginstatus=='unlogin'?'':'login'"></header-cont>
        <div class="main">
            <div class="main_left">
                <div class="main_left_cont main_left_cont_notice">
                    <div class="cont_header">
                        <div class="name">
                            <img src="@/assets/img/tzgg_title.png" />
                            <!--<span>通知公告</span>-->
                        </div>
                        <div class="more" @click="moreFn(0)">
                            <span>更多</span>
                            <img src="@/assets/img/more.png" />
                        </div>
                    </div>
                    <ul class="cont_list">
                        <li @click="viewDetail(item.id)" class="cont_li" v-for="(item, index) in dataList" :key="index">
                            <span class="notice_title">{{item.tzggZbt}}</span>
                            <span class="notice_date">{{item.createTime}}</span>
                        </li>
                    </ul>
                </div>
                <div class="main_left_cont main_left_cont_ziliao">
                    <div class="cont_header">
                        <div class="name">
                            <img src="@/assets/img/zlzx_title.png" />
                            <!--<span>资料中心</span>-->
                        </div>
                        <div class="more" @click="moreFn(1)">
                            <span>更多</span>
                            <img src="@/assets/img/more.png" />
                        </div>
                    </div>
                    <ul class="cont_list">
                        <li class="cont_li" @click="downloadZl(item.filePath, item.zlMc)"
                            v-for="(item, index) in zlList" :key="index">
                            <span class="notice_title">{{item.zlMc}}</span>
                            <!--
                            <span class="notice_date">{{item.createTime}}</span>
                            -->
                        </li>
                    </ul>
                </div>
            </div>
            <!-- <div class="main_right">
          <div class="main_right_cont">
            <div class="enter_tit">
                <span>申报入口</span>
                <span @click="expertLogin">专家登录</span>
            </div>
            <ul class="sbrk">
              <li @click="handelKjcxj">
                <b>电力科技创新奖</b>
                <img src="../../../assets/img/1.png" alt="">
              </li>
              <li @click="handelZgcxj">
                <b>电力职工技术创新奖</b>
                <img src="../../../assets/img/2.png" alt="">
              </li>
            </ul>
          </div>
        </div> -->
            <div class="main_right">
                <div class="main_right_cont">
                    <a-tabs size="large" default-active-key="1">
                        <a-tab-pane key="1">
                            <span slot="tab">
                                <img src="../../../assets/img/sbrk.jpg" alt="">
                            </span>
                            <ul class="sbrk">
                                <li @click="handelKjcxj">
                                    <b>电力科技创新奖</b>
                                    <img src="../../../assets/img/1.png" alt="">
                                </li>
                                <li @click="handelZgcxj">
                                    <b>电力职工技术创新奖</b>
                                    <img src="../../../assets/img/2.png" alt="">
                                </li>
                            </ul>
                            <!-- Content of Tab Pane 1 -->
                        </a-tab-pane>
                        <a-tab-pane key="2" force-render>
                            <span slot="tab">
                                <img src="../../../assets/img/zjdl.jpg" alt="">
                            </span>
                            <ul class="sbrk">
                                <li @click="handelZjKjcxj">
                                    <b style="font-size:22px;">电力科技创新奖专家登录</b>
                                    <img src="../../../assets/img/1.png" alt="">
                                </li>
                                <li @click="handelZgZjcxj">
                                    <b style="font-size:22px;">电力职工技术创新奖专家登录</b>
                                    <img src="../../../assets/img/2.png" alt="">
                                </li>
                            </ul>
                        </a-tab-pane>
                        <a-tab-pane key="3" force-render>
                            <span slot="tab">
                                <img src="../../../assets/img/tjdwdl.jpg" alt="">
                                <!-- 20230519 - 杨青
                                注：图片需要替换为【推荐单位登录】 -->
                            </span>
                            <ul class="sbrk">
                                <li @click="handelZjKjcxj1">
                                    <b style="font-size:22px;">电力科技创新奖登录</b>
                                    <img src="../../../assets/img/1.png" alt="">
                                </li>
                                <li @click="handelZgZjcxj1">
                                    <b style="font-size:22px;">电力职工技术创新奖登录</b>
                                    <img src="../../../assets/img/2.png" alt="">
                                </li>
                            </ul>
                        </a-tab-pane>
                    </a-tabs>
                </div>
            </div>
            <!--<div class="lineTitle">
                <div class="line"></div>
                <b>奖项设置</b>
                <div class="line"></div>
            </div>
            <div class="cont">
                <h2>电力创新奖实行分类评审</h2>
                <p>（1）电力科技创新奖: 包括技术、信息化、标准、管理、专利五类成果；</p>
                <p>（2）电力职工技术创新奖。</p>
                <h2>电力创新奖设三个奖励等级</h2>
                <p>其中，电力科技创新奖设大奖、一等奖、二等奖。电力职工技术创新奖设一等奖、二等奖、三等奖。</p>
            </div>-->
        </div>
        <footer-cont></footer-cont>
    </div>
</template>

<script>
    import headerCont from '@/views/declarationSystem/common/header-login';
    import footerCont from '@/views/declarationSystem/common/footer';
    import {
        cxjsbPageList,
        sysCxjZlList,
        sysCxjFlCxjsbList,
        sysCxjZlDownload
    } from '@/api/shenbao';
    export default {
        components: {
            headerCont,
            footerCont,
        },
        mounted() {
            var islogin = sessionStorage.getItem('islogin');
            if (islogin == '1') {
                this.loginstatus = 'login';
                this.getSysCxjFlCxjsbList();
            } else {
                var shenbao_phoneNumber = localStorage.getItem('shenbao_phoneNumber');
                var shenbao_passWord = localStorage.getItem('shenbao_passWord');
                if (shenbao_phoneNumber && shenbao_passWord) {
                    this.codephone = shenbao_phoneNumber;
                    this.codepwd = shenbao_passWord;
                    this.checked = true;
                }
                this.loginstatus = 'unlogin';
            }
            this.getList();
            this.getZlList();
        },
        data() {
            return {
                loginstatus: 'unlogin',
                dataList: [],
                zlList: [],
                cxjsbList: [],
            }
        },
        methods: {
            // 专家登录
            handelZjKjcxj() {
                // this.$router.push('/shenbao/exportLogin')
                window.open("https://cxj.cec.org.cn/user/zj", '_blank')
            },
            // 职工创新奖登录【专家】
            handelZgZjcxj() {
                // 申报登录入口
                window.open("https://zgcgps.cec.org.cn", '_blank')
            },
            handelKjcxj() {
                this.$router.push('/shenbao/login')
            },
            // 职工创新奖登录
            handelZgcxj() {
                //this.$router.push('/user/login')
                window.open("https://zgcg.cec.org.cn", '_blank')
            },
            // 推荐单位 - 电力科技创新奖登录
            handelZjKjcxj1() {
                window.open("https://cxj.cec.org.cn/user/tjdw", '_blank')
            },
            // 推荐单位 - 电力职工技术创新奖登录
            handelZgZjcxj1() {
                window.open("https://zgcgps.cec.org.cn", '_blank')
            },
            moreFn(ind) {
                this.$router.push('/shenbao/articleList?ind=' + ind)
            },
            // 获取申报列表
            getList() {
                cxjsbPageList().then(res => {
                    if (res.data.success) {
                        this.dataList = res.data.result.records;
                    }
                })
            },
            // 获取资料中心列表
            getZlList() {
                sysCxjZlList().then(res => {
                    if (res.data.success) {
                        this.zlList = res.data.result.records;
                    }
                })
            },
            // 跳转详情
            viewDetail(id) {
                this.$router.push({
                    path: '/shenbao/innovationAwardNotice',
                    query: {
                        id
                    }
                })
            },
            getSysCxjFlCxjsbList() {
                sysCxjFlCxjsbList().then(res => {
                    let data = res.data;
                    if (data.success) {
                        this.cxjsbList = data.result;
                    }
                }).catch(err => {
                    sessionStorage.clear();
                    this.loginstatus = 'unlogin';
                })
            },
            downloadZl(url, zlMc) {
                let that = this;
                let fileGs = url.split('.');
                sysCxjZlDownload(url).then(res => {
                    that.downfn(zlMc, res, fileGs[1]);
                })
            },
            downfn(title, res, fileGs) {
                const data = res.data;
                const url = window.URL.createObjectURL(new Blob([data], {
                    type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
                }))
                // const url = window.URL.createObjectURL(new Blob([data], {type: "application/octet-stream"}))
                const link = document.createElement('a')
                link.style.display = 'none'
                link.href = url;
                link.setAttribute('download', title + '.' + fileGs)
                document.body.appendChild(link)
                link.click()
                document.body.removeChild(link)
            }
        }
    }
</script>

<style scoped lang='less'>
    .entrance {
        width: 100%;
        background-color: #F7F7F7;

        // display: flex;
        // flex-direction: column;
        .main {
            width: 1210px;
            margin: 0 auto;
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            margin-top: 20px;
        }

        .main_left {
            width: 685px;
        }

        .cont_header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            border-bottom: 1px solid #EEEEEE;
            padding-left: 30px;
            padding-right: 32px;
            box-sizing: border-box;
            height: 52px;

            .name {
                height: 100%;
                display: flex;
                align-items: center;
                border-bottom: 2px solid #2381D6;

                span {
                    margin-left: 11px;
                    font-size: 20px;
                    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
                    font-weight: bold;
                    color: #333333;
                    line-height: 22px;
                }
            }

            .more {
                cursor: pointer;
                display: flex;
                align-items: center;

                span {
                    margin-right: 8px;
                    font-size: 16px;
                    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
                    color: #006DC0;
                    line-height: 22px;
                }
            }
        }

        .main_left_cont {
            width: 685px;
            background: #FFFFFF;

            &.main_left_cont_notice {
                height: 258px;
            }

            &.main_left_cont_ziliao {
                height: 258px;
                margin-top: 20px;
            }

            &.main_left_cont_huojiang {
                height: 220px;
                margin-top: 20px;
            }

            .cont_list {
                padding-left: 18px;
                padding-right: 32px;
                box-sizing: border-box;
                height: 200px;
                overflow: hidden;

                .cont_li {
                    height: 48px;
                    display: flex;
                    justify-content: space-between;
                    align-items: center;
                    border-bottom: 1px solid #EEEEEE;
                    cursor: pointer;

                    .notice_title {
                        font-size: 16px;
                        font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
                        color: #4C5F82;
                        line-height: 22px;
                    }

                    .notice_date {
                        height: 22px;
                        font-size: 16px;
                        font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
                        color: #4B5F82;
                        line-height: 22px;
                    }
                }
            }

            .search_cont {
                .search_input {
                    display: flex;
                    align-items: center;
                    padding-left: 27px;
                    padding-right: 33px;
                    margin-top: 20px;

                    .input_li {
                        width: 195px;
                        height: 50px;
                        border-radius: 4px;
                        position: relative;

                        img {
                            position: absolute;
                            top: 16px;
                            left: 15px;
                        }

                        input {
                            width: 100%;
                            height: 100%;
                            text-indent: 23px;
                            border: 1px solid #ECEBEB;
                        }

                        &:nth-of-type(1) {
                            margin-right: 20px;
                        }

                        &:nth-of-type(2) {
                            margin-right: 20px;
                        }
                    }
                }

                .search_btn {
                    width: 160px;
                    height: 46px;
                    background: linear-gradient(90deg, #3D9CED 0%, #1A60C7 99%, #1A60C7 100%);
                    border-radius: 5px;
                    font-size: 22px;
                    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
                    color: #FFFFFF;
                    line-height: 46px;
                    text-align: center;
                    margin: 20px auto 0;
                    cursor: pointer;
                }
            }
        }

        .main_right {
            width: 506px;

            .main_right_cont {
                width: 506px;
                height: 536px;
                background: #FFFFFF;

                .ant-tabs-tab {
                    font-size: 20px;
                }

                &.main_right_cont_login {
                    height: 536px;
                    padding: 0 36px;
                    box-sizing: border-box;
                }

                &.main_right_cont_enter {
                    height: 536px;
                    padding: 0 31px 0 37px;
                    box-sizing: border-box;
                }

                &.main_right_cont_set {
                    height: 220px;
                    margin-top: 20px;
                }
            }
        }

        .enter_tit {
            line-height: 48px;
            padding-top: 20px;
            padding-left: 20px;
            color: #0a4174;

            span {
                font-size: 30px;

                &:nth-child(1) {
                    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
                    font-weight: 500;
                }

                &:last-child {
                    margin-left: 20px;
                    cursor: pointer;
                }
            }
        }

        .sbrk {
            width: 100%;
            height: auto;
            justify-content: space-between;
            margin-left: 50px;

            li {
                position: relative;
                width: 400px;
                height: 140px;
                background-color: #2680eb;
                border-radius: 15px;
                display: flex;
                align-items: center;
                justify-content: center;
                cursor: pointer;
                margin-top: 40px;
                margin-bottom: 60px;

                &:nth-child(1) {
                    // background: #2680eb;
                    background: url('../../../assets/img/bg2.png') no-repeat;
                    background-size: auto 100%;
                }

                &:nth-child(2) {
                    background: url('../../../assets/img/bg1.png') no-repeat;
                    background-size: auto 100%;
                }

                b {
                    text-align: center;
                    font-size: 30px;
                    font-weight: normal;
                    color: #ffffff;
                    padding-right: 60px;
                    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
                }

                img {
                    width: 80px;
                    height: 80px;
                    position: absolute;
                    right: 20px;
                    top: 32px;
                }
            }
        }

        .lineTitle {
            width: 272px;
            height: 29px;
            display: flex;
            align-items: center;
            margin: 63px auto 0;

            .line {
                width: 68px;
                height: 1px;
                background: #2680eb;
            }

            b {
                display: inline-block;
                width: 136px;
                text-align: center;
                font-size: 30px;
                color: #333;
            }
        }

        .cont {
            margin-top: 42px;
            margin-bottom: 60px;
            width: 100%;
            height: 249px;
            border-radius: 15px;
            border: solid 1px #e5e5e5;
            padding: 36px 27px;

            h2 {
                color: #333;
            }

            p {
                color: #666;
            }
        }
    }
</style>